<?php

namespace app\admin\controller\users;

use app\Base;
use app\service\admin\UserService;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\response\Json;
use think\response\View;

class User extends Base
{

    /**
     * 页面
     * @return View
     */
    public function show(): View
    {
        return view('users/index');
    }

    /**
     * 列表数据
     * @param UserService $service
     * @return Json
     * @throws DataNotFoundException
     * @throws DbException
     * @throws ModelNotFoundException
     */
    public function getList(UserService $service): Json
    {
        $res = $service::getList($this->params);
        $this->res['count'] = $res['count'];
        $this->res['data'] = $res['data'];
        return $this->returnData();
    }

    public function add()
    {
    }

    public function update()
    {
    }

    public function delete()
    {
    }
}